﻿using System.Collections.Generic;
using UnityEngine;

public class ResourceChecksumData : ScriptableObject {

    [SerializeField]
    public List<ChecksumData> ChecksumList = new List<ChecksumData>();

    [SerializeField]
    public PackageMetaInfo packageMetaInfo;

    public void Clear()
    {
        ChecksumList.Clear();
    }

    public void Add(string name, int size, string checksum)
    {
        ChecksumList.Add(new ChecksumData(name, size, checksum));
    }

    public override string ToString()
    {
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        for(int i = 0; i < ChecksumList.Count; i++)
        {
            sb.Append(ChecksumList[i].filename).Append(",");
            sb.Append(ChecksumList[i].filesize).Append(",");
            sb.Append(ChecksumList[i].checksum);
            sb.Append('\n');
        }
        return sb.ToString();
    }
}
